package com.mg.demo;

import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.ushaqi.zhuishushenqi.ZSPlugin;


/**
 * 授权-登录
 *
 * @author Shaojie
 * @Date 2014-1-22 上午9:28:24
 */
public class AuthLoginActivity extends Activity implements OnClickListener {

    private EditText mPhoneNumEdt;
    private Button mBtnTicket, mBtnTicketDef;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(com.mg.demo.R.layout.activity_login);
        setTitle("");
        initView();


    }


    private void initView() {

        mPhoneNumEdt = (EditText) findViewById(com.mg.demo.R.id.edit_phone);
        mBtnTicket = (Button) findViewById(com.mg.demo.R.id.btn_ticket_login);
        mBtnTicketDef = (Button) findViewById(com.mg.demo.R.id.btn_def_ticket_login);

        mBtnTicket.setOnClickListener(this);
        mBtnTicketDef.setOnClickListener(this);


    }


    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id) {
            case com.mg.demo.R.id.btn_ticket_login:
                String phoneNum = mPhoneNumEdt.getText().toString().trim();
                if (TextUtils.isEmpty(phoneNum)) {
                    Toast.makeText(this, "ticket不能为空", 0).show();
                    return;
                }
                ZSPlugin.get().syncAccount( getApplication(),phoneNum);
                finish();
                break;
            case com.mg.demo.R.id.btn_def_ticket_login:
                ZSPlugin.get().syncAccount(getApplication(),"2FPW3582XTPGVBGL234D");
                finish();
                break;
        }
    }



}
